from abc import ABC, abstractmethod

from ai_core.audio_format.opus import OpusEncode


class Asr(ABC):
    def opus_data_to_wav(self, opus_data, file_path):
        """将 opus 数据转化为 wav 文件, 并保存到file_path"""
        opus = OpusEncode()
        print(f"[Asr(ABC)] opus_data_to_wav: {file_path}")
        opus.opus_to_wav_file(file_path, opus_data)

    @abstractmethod
    def opus_data_to_text(self, opus_data):
        """opus数据 -> 文件"""
        raise NotImplementedError